﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<VMCarViewIndex>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MoreLinks" runat="server"> 
    <% Html.RenderAction("Menu","CarView"); %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">

    <div id="queryarea">
        <div class="querybanner">
            <%: Html.Label(Html.Resource("CarViewIndexCategoryText"))%>
<%--            <%: Html.Label(Html.Resource(Model.QueryInfo.SelectedCategory.CategoryName))%>--%>
            <%: Html.Label(Model.QueryInfo.SelectedCategory.CategoryName)%>
        </div>

        <div class="queryitem">
            <%: Html.Label(Html.Resource("CarViewIndexBrandText"))%>
            <%foreach(var b in Model.brands) {%>
                <%: Html.ActionLink(
                    (b.id == 0) ? "全部" : b.name,
                   "Index",
                   "CarView",
                    new { queryinfo = Model.BuildQueryStringForBrand(b.id) },
                    Model.BuildBrandLinkAttr(b.id)
                   )%>
            <%} %>
        </div>

        <div class="queryitem">
            <%: Html.Label(Html.Resource("CarViewIndexPriceText"))%>
            <% foreach (var p in Model.prices)
               { %>
               <%: Html.ActionLink(
                       (p.low == 0 && p.high == 0) ? "全部" : string.Format("{0}-{1}", p.low, (p.high == 0) ? "" : p.high.ToString()),
                   "Index",
                   "CarView",
                    new { queryinfo = Model.BuildQueryStringForPrice(p.low, p.high) },
                    Model.BuildPriceLinkAttr(p)
                   )%>
            <%} %>
        </div>

    </div>

    <div>
        
        <%foreach (var m in Model.Cars)
          { %>
          <% Html.RenderPartial("CarListItemControl",m); %>
        <%} %>

    </div>

    <div id="pager">
        
        <%: Html.PageLinks2(Model.QueryInfo.PageInfo,
                          i => Url.Action("Index", "CarView", new
                          {
                              queryinfo = Model.BuildQueryStringForPage(i)
              })) %>

    </div>

</asp:Content>
